package com.ambitor.grass.sql.statement;

import java.sql.Connection;

public class BatchStatementImpl extends StatementImpl implements BatchOperation {
	
	private String[] sqls;

	public BatchStatementImpl(Connection conn,String[] sqls) throws Exception {
		super(conn);
		this.sqls = sqls;
	}
	
	public int[] executeBatch() throws Exception {
		for (int i = 0; i < this.sqls.length; ++i) {
		      this.getStatement().addBatch(this.sqls[i]);
		}
		int[] result = this.getStatement().executeBatch();
		this.close();     //
		return result;
	}

}
